<?python 
  
  from whatwhat.utils import textilize, getGroups
  from whatwhat.model import impact_codes, chance_codes
  from turbogears.i18n.format import format_date
  from turbogears import identity
  
  groupids = getGroups()
  
  def get_class(risk):
      if risk.closed: return "closed"
      else: return ""
?>

<tr xmlns:py="http://purl.org/kid/ns#" id="risk_$risk.id" class="${get_class(risk)}">
	<td py:if="(identity.current.user != risk.creator and (not 'admin' in groupids)) or read_only">${impact_codes[risk.impact]}</td>
	<td py:if="(not read_only) and (identity.current.user == risk.creator or 'admin' in groupids)">
		<select id="risk_impact_$risk.id" name="impact" onchange="modify_risk($risk.id)">
			<option py:for="key, description in impact_codes.items()" value="$key" selected="${(None, '')[key == risk.impact]}">
				${description}
			</option>
		</select>
	</td>				
	<td py:if="(identity.current.user != risk.creator and (not 'admin' in groupids)) or read_only">${chance_codes[risk.chance]}</td>
	<td py:if="(not read_only) and (identity.current.user == risk.creator or 'admin' in groupids)">
		<select id="risk_chance_$risk.id" name="chance" onchange="modify_risk($risk.id)">
			<option py:for="key, description in chance_codes.items()" value="$key" selected="${(None, '')[key == risk.chance]}">
				${description}
			</option>
		</select>
	</td>
	<td>${risk.description}</td>
	<td>
		<a href="mailto:$risk.creator.emailAddress">${risk.creator.displayName}</a>
	</td>
	<td>${format_date(risk.creation_date, format='short', time_format=' %I:%M %p')}</td>
	<td py:if="not read_only">
		<a href="#" onclick="close_risk($risk.id); return false;">X</a>
	</td>
</tr>
